Add Maestro test for Image.getSize with local drawable resources#56945
Open
Abbondanzo wants to merge 2 commits into
Open
Add Maestro test for Image.getSize with local drawable resources#56945Abbondanzo wants to merge 2 commits into
Image.getSize with local drawable resources#56945Abbondanzo wants to merge 2 commits into
Conversation
…ook#56944) Summary: `Image.getSize()` and `Image.getSizeWithHeaders()` always failed for Android drawable resource URIs (e.g. `"res_ic_home_filled_20"`) because Fresco's `fetchEncodedImage` pipeline does not handle `res://` URIs — it throws `IllegalArgumentException("Unsupported uri scheme for encoded image fetch!")`. This adds a fast path in `ImageLoaderModule` that detects resource URIs via `ImageSource.isResource` and resolves their intrinsic dimensions through Android's `Drawable` API (`ResourceDrawableIdHelper.getResourceDrawable()` -> `Drawable.getIntrinsicWidth/Height()`). This works for all drawable types including VectorDrawables, which are compiled XML and cannot be decoded by Fresco's raster-oriented pipeline. For non-resource URIs (network, file, content), the existing Fresco `fetchEncodedImage` path is unchanged. Changelog: [Android][Fixed] - Fix `Image.getSize()` failing for local drawable resource URIs including VectorDrawables Differential Revision: D106045223
Summary: Adds a Maestro E2E test that exercises the new RNTester example for `Image.getSize()` with Android drawable resources. The test navigates to the Image examples, opens the "Image.getSize with local drawables" example, taps the run button, and verifies that VectorDrawable and PNG drawable dimensions are returned correctly in dp, and that the error case for a nonexistent drawable shows an error message. Changelog: [Internal] Differential Revision: D106089813
|
@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D106089813. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Adds a Maestro E2E test that exercises the new RNTester example for
Image.getSize()with Android drawable resources. The test navigates to the Image examples, opens the "Image.getSize with local drawables" example, taps the run button, and verifies that VectorDrawable and PNG drawable dimensions are returned correctly in dp, and that the error case for a nonexistent drawable shows an error message.Changelog:
[Internal]
Differential Revision: D106089813